package com.leetcode.partition21;

/**
 * @author `RKC`
 * @date 2022/2/9 10:59
 */
public class LC2006差的绝对值为K的数对数目 {

    public int countKDifference(int[] nums, int k) {
        int ans = 0, n = nums.length;
        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                if (Math.abs(nums[j] - nums[i]) == k) ans++;
            }
        }
        return ans;
    }
}
